<?php

class Users_M extends I_Model {

    protected $_table_name = 'users';
    protected $_primary_key = 'ID';
    protected $_primary_filter = 'intval';
    protected $_order_by = 'ID';
    public $rules = array();
    protected $_timestamps = FALSE;

    public function __construct() {
        parent::__construct();
    }

   
	 function all_info($id = null){
	 	
	 	$m = 'result';  
	 	$this->db->select('g.*,u.*,p.*') 
	 	           ->from('users as u')
	 	           ->join('groups as g','g.ID=u.GROUP_ID')
	 	           ->join('profiles as p','p.USER_ID=u.ID');
	 	
	 	
	 	if(!is_null($id) && !is_array($id)){
	 		       $m = 'row';
	 	           $this->db->where('u.ID',$id);
	 	}
                if(is_array($id)){
                     $this->db->where($id);
                }
	 	
	 	$q = $this->db->get();
	 	return  $q->$m();
	 	
	 }
         
         
         
    
}
